home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: gail.ripco.com!mambuhl
- From: mambuhl@ripco.com (Martin Ambuhl)
- Subject: Re: a dump question from
- X-Nntp-Posting-Host: golden.ripco.com
- Message-ID: <DLz0o9.KIF@rci.ripco.com>
- Sender: usenet@rci.ripco.com (Net News Admin)
- Organization: Ripco Internet BBS Chicago
- Date: Tue, 30 Jan 1996 01:40:56 GMT
- X-Ident-Sender: mambuhl
-
- jyli@climate.gsfc.nasa.gov (Jason Li)
- in <jyli-2801960040100001@li.gsfc.nasa.gov> asks:
-
- >I have just started programming in C, still feel dizzy sometimes when
- >looking at cryptic C code. Occasionally I come across code like this:
-
- >for (iv=0; iv < specp->nlvars; iv++)
-
- >what does this symbol "->" mean? I've looked all over my C books, could
- >not find anything on it.
-
- Your C books should have indices, in which you could look up
- -> (Usually lexically before the alphas)
- * or *
- component-selection operator
-
- Component selection operators are used to access components of struct and
- union types.
-
- Suppose you define a struct type:
-
- typedef struct {
- int a, b;
- } INT_PAIR;
-
- Now you can define a variable of this type or a pointer to such a variable:
-
- INT_PAIR pair, *ptr2pair;
-
- If you make
- ptr2pair = &pair;
-
- then
- pair.a
- and
- ptr2pair->a
-
- select the same member of the same object.
-
-
- --
- * Martin Ambuhl net: mambuhl@ripco.com
- * Chicago, IL (USA)
-